<template>
  <div class="detail">
    <DetailBanner
      :sightName='sightName'
      :bannerImg='bannerImg'
      :bannerImgs='gallaryImgs'
    ></DetailBanner>
    <DetailHeader></DetailHeader>
    <DetailList :list='list'></DetailList>
  </div>
</template>
<script>
import axios from 'axios'
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallaryImgs: []

    }
  },
  methods: {
    getDetailInfo () {
      axios.get('api/detail.json?id=' + this.$route.params.id).then(
        this.handelAjaxSuccess
      )
    },
    handelAjaxSuccess (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.list = data.categoryList
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>
<style scoped lang='stylus'>
.content
  height:20rem
</style>
